package com.wzx.util;

import com.wzx.domain.Birthday;
import com.wzx.domain.Person;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

//2:假数据
public class Db {
    private static List<Person> list;
    static {
        list = new ArrayList<Person>();

        list.add(new Person(1,"jack","123456","北京",new Birthday(1998,1,10),new Date()));
        list.add(new Person(2,"rose","123456","changsha",new Birthday(1992,2,10),new Date()));
        list.add(new Person(3,"tony","123456","changsha",new Birthday(1993,3,10),new Date()));
    }
    public static List<Person> findAll(){
        return list;
    }

    public static Person findById(int id) {
        Person p = null;
        for(Person person:list){
            if(id == person.getId()){
                p = person;
            }
        }
        return p;
    }
}
